<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#">文件管理</a></li>
    </ul>
    <form class="js-ajax-form" action="{:url('Menu/listOrder')}" method="post">
        <div class="table-actions">
            <button class="btn btn-primary btn-sm js-ajax-submit" type="submit">{:lang('SORT')}</button>
        </div>
        <table class="table table-hover table-bordered table-list" id="menus-table">
        	<thead>
        		<th></th>
        		<th>预览</th>
        		<th>路径</th>
        	</thead>
        	<tbody id="bb">
        		<volist name="list" id="vo">
    			<tr data-key="{$key}" onclick="toshow( '{$key}' )">
	        		<!-- <td>{$vo.show_img}</td> -->
	        		<td>{$vo.file_path}</td>
	        		<td>{$vo.down_path}</td>
        		</tr>
	        	</volist>
        	</tbody>
        </table>
        <div class="table-actions">
            <button class="btn btn-primary btn-sm js-ajax-submit" type="submit">{:lang('SORT')}</button>
        </div>
    </form>
    <div id="show" style="display: none;position: fixed ;top:10px;left:100px;background-color: black; width:80%;height: 80%">
    	
    	<div>
    		<a href="javascript:;" onclick="closes( )">关闭</a>
    		<a href="javascript:;" onclick="up()">上一张</a>
    		<a href="javascript:;" onclick="down()">下一张</a>
    		<a href="javascript:;" onclick="todelete( )">删除</a>
    	</div>
    	<div id="lj" style="color: white; font-size: 18px;"></div>
    	<div id="ts" style="color: white; font-size: 18px;">
    		
    	</div>
    	<img src="" id="show_img"/ style="max-width: 100%;height: 500px;">
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
var key = 0;
var closes = function(){
	$( '#show' ).hide();
}
   var toshow = function( k ){
   		key = k
   		console.log( key )
   		$( '#show' ).show();
   		$( '#show_img' ).attr( 'src' , $('#bb tr:eq('+k+') td:eq(1)').text() );
   		$( '#lj' ).text( $('#bb tr:eq('+k+') td:eq(0)').text() );
   		$('#ts').text( '' );
   }
   var up = function(){
	    key -- 
	    if( key < 0 ) key = 0
	    toshow( key )
   }
   var down = function(){
	    key ++ 
	    
	    toshow( key )
   }
   var todelete= function(){
   		$.post('{:url("admin/file_manage/todel")}',
   			{ path:$('#bb tr:eq('+key+') td:eq(0)').text()},
   			function( res ){
   				console.log( res )
   				$('#ts').text( '提示：'+ res.message );
   			});
   }
</script>
</body>
</html>